package tmooc;

import java.util.Arrays;
import java.util.Random;

public class MaxOfArray {
    public static void main(String[] args) {
/*


        int[]arr = new int[10];
        for (int i =1;i<arr.length;i++){
            arr[i]= (int)(Math.random()*100);
        }
        int max = arr[0];
        for (int i = 1;i<arr.length;i++){
            if (arr[i]>max){
                max = arr[i];
            }
        }
        arr = Arrays.copyOf(arr,arr.length+1);
        arr[arr.length-1] = max;
        for (int i = 1;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("最大值为:" + max);



        int[]arr = new int[10];
        for (int i =1;i<arr.length;i++){
            arr[i]= (int)(Math.random()*100);
        }
        int max = arr[0];
        for (int i = 1;i<arr.length;i++){
            if (arr[i]>max){
                max = arr[i];
            }
        }
        arr = Arrays.copyOf(arr,arr.length+1);
        arr[arr.length-1] = max;
        for (int i = 1;i<arr.length;i++){
            System.out.println(arr[i]);
        }=
        System.out.println("最大值为:" + max);
      */
        say();
        say("星雨");
        say("星雨",5);

        double a = getNum();
        System.out.println(a);

        int[] c = generateArray();
        System.out.println("开始输出数组 长度为" + c.length);
        for (int i = 0;i<c.length;i++){
            System.out.println("第" + (i + 1) + "的数值为:"+c[i]);
        }


        int m=5,n=88;
        int b = plus(m,n);
        System.out.println(b);

    }






    public static void say() {
        System.out.println("Hello World");
    }
    public static void say(String name) {
        System.out.println("我是"+name+"今年五岁");
    }
    public static void say(String name,int age) {
        System.out.println("我是"+name+"今年" +age + "岁");
    }


    public static double getNum(){
        return 8.88;
    }

    public static int[] generateArray(){
        Random rand = new Random();
        int[] arr = new int[10];
        for (int i= 0 ;i<arr.length;i++){
            arr[i] = rand.nextInt(100);
        }
        return arr;
    }




    public static int plus(int num1,int num2){
        int num = num1 + num2;
        return num;
    }
}
